/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.eclipse.emf.ecore.impl;

import org.eclipse.emf.ecore.DSManagementInterface;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.Parameter;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>DS Management Interface</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ecore.impl.DSManagementInterfaceImpl#getInputParameter <em>Input Parameter</em>}</li>
 *   <li>{@link ecore.impl.DSManagementInterfaceImpl#getRuntimeData <em>Runtime Data</em>}</li>
 *   <li>{@link ecore.impl.DSManagementInterfaceImpl#getInterfaceName <em>Interface Name</em>}</li>
 *   <li>{@link ecore.impl.DSManagementInterfaceImpl#getRequiredData <em>Required Data</em>}</li>
 *   <li>{@link ecore.impl.DSManagementInterfaceImpl#getCommunicationProtocal <em>Communication Protocal</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DSManagementInterfaceImpl extends EObjectImpl implements DSManagementInterface {
	/**
	 * The cached value of the '{@link #getInputParameter() <em>Input Parameter</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInputParameter()
	 * @generated
	 * @ordered
	 */
	protected EList inputParameter;

	/**
	 * The cached value of the '{@link #getRuntimeData() <em>Runtime Data</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRuntimeData()
	 * @generated
	 * @ordered
	 */
	protected Parameter runtimeData;

	/**
	 * The default value of the '{@link #getInterfaceName() <em>Interface Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInterfaceName()
	 * @generated
	 * @ordered
	 */
	protected static final String INTERFACE_NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getInterfaceName() <em>Interface Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInterfaceName()
	 * @generated
	 * @ordered
	 */
	protected String interfaceName = INTERFACE_NAME_EDEFAULT;

	/**
	 * The cached value of the '{@link #getRequiredData() <em>Required Data</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRequiredData()
	 * @generated
	 * @ordered
	 */
	protected EList requiredData;

	/**
	 * The default value of the '{@link #getCommunicationProtocal() <em>Communication Protocal</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCommunicationProtocal()
	 * @generated
	 * @ordered
	 */
	protected static final String COMMUNICATION_PROTOCAL_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getCommunicationProtocal() <em>Communication Protocal</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCommunicationProtocal()
	 * @generated
	 * @ordered
	 */
	protected String communicationProtocal = COMMUNICATION_PROTOCAL_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DSManagementInterfaceImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return EcorePackage.Literals.DS_MANAGEMENT_INTERFACE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getInputParameter() {
		if (inputParameter == null) {
			inputParameter = new EObjectContainmentEList(Parameter.class, this, EcorePackage.DS_MANAGEMENT_INTERFACE__INPUT_PARAMETER);
		}
		return inputParameter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Parameter getRuntimeData() {
		return runtimeData;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetRuntimeData(Parameter newRuntimeData, NotificationChain msgs) {
		Parameter oldRuntimeData = runtimeData;
		runtimeData = newRuntimeData;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA, oldRuntimeData, newRuntimeData);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRuntimeData(Parameter newRuntimeData) {
		if (newRuntimeData != runtimeData) {
			NotificationChain msgs = null;
			if (runtimeData != null)
				msgs = ((InternalEObject)runtimeData).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA, null, msgs);
			if (newRuntimeData != null)
				msgs = ((InternalEObject)newRuntimeData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA, null, msgs);
			msgs = basicSetRuntimeData(newRuntimeData, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA, newRuntimeData, newRuntimeData));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getInterfaceName() {
		return interfaceName;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInterfaceName(String newInterfaceName) {
		String oldInterfaceName = interfaceName;
		interfaceName = newInterfaceName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.DS_MANAGEMENT_INTERFACE__INTERFACE_NAME, oldInterfaceName, interfaceName));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getRequiredData() {
		if (requiredData == null) {
			requiredData = new EObjectResolvingEList(EAttribute.class, this, EcorePackage.DS_MANAGEMENT_INTERFACE__REQUIRED_DATA);
		}
		return requiredData;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getCommunicationProtocal() {
		return communicationProtocal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCommunicationProtocal(String newCommunicationProtocal) {
		String oldCommunicationProtocal = communicationProtocal;
		communicationProtocal = newCommunicationProtocal;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.DS_MANAGEMENT_INTERFACE__COMMUNICATION_PROTOCAL, oldCommunicationProtocal, communicationProtocal));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INPUT_PARAMETER:
				return ((InternalEList)getInputParameter()).basicRemove(otherEnd, msgs);
			case EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA:
				return basicSetRuntimeData(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INPUT_PARAMETER:
				return getInputParameter();
			case EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA:
				return getRuntimeData();
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INTERFACE_NAME:
				return getInterfaceName();
			case EcorePackage.DS_MANAGEMENT_INTERFACE__REQUIRED_DATA:
				return getRequiredData();
			case EcorePackage.DS_MANAGEMENT_INTERFACE__COMMUNICATION_PROTOCAL:
				return getCommunicationProtocal();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INPUT_PARAMETER:
				getInputParameter().clear();
				getInputParameter().addAll((Collection)newValue);
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA:
				setRuntimeData((Parameter)newValue);
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INTERFACE_NAME:
				setInterfaceName((String)newValue);
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__REQUIRED_DATA:
				getRequiredData().clear();
				getRequiredData().addAll((Collection)newValue);
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__COMMUNICATION_PROTOCAL:
				setCommunicationProtocal((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INPUT_PARAMETER:
				getInputParameter().clear();
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA:
				setRuntimeData((Parameter)null);
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INTERFACE_NAME:
				setInterfaceName(INTERFACE_NAME_EDEFAULT);
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__REQUIRED_DATA:
				getRequiredData().clear();
				return;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__COMMUNICATION_PROTOCAL:
				setCommunicationProtocal(COMMUNICATION_PROTOCAL_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INPUT_PARAMETER:
				return inputParameter != null && !inputParameter.isEmpty();
			case EcorePackage.DS_MANAGEMENT_INTERFACE__RUNTIME_DATA:
				return runtimeData != null;
			case EcorePackage.DS_MANAGEMENT_INTERFACE__INTERFACE_NAME:
				return INTERFACE_NAME_EDEFAULT == null ? interfaceName != null : !INTERFACE_NAME_EDEFAULT.equals(interfaceName);
			case EcorePackage.DS_MANAGEMENT_INTERFACE__REQUIRED_DATA:
				return requiredData != null && !requiredData.isEmpty();
			case EcorePackage.DS_MANAGEMENT_INTERFACE__COMMUNICATION_PROTOCAL:
				return COMMUNICATION_PROTOCAL_EDEFAULT == null ? communicationProtocal != null : !COMMUNICATION_PROTOCAL_EDEFAULT.equals(communicationProtocal);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (interfaceName: ");
		result.append(interfaceName);
		result.append(", communicationProtocal: ");
		result.append(communicationProtocal);
		result.append(')');
		return result.toString();
	}

} //DSManagementInterfaceImpl
